{extend name="base"}
{block name="title"}<title>录入界面</title>{/block}

{block name="div"}

<div id="main" style="width: 1300px;height:650px;margin:0 auto;background-color: antiquewhite;">
    <div id="srkll" style="display: none;">
        <h1 id="mrysjl">每日饮食记录</h1>
        <form action="http://jianfei.lightrain.org.cn/index/srkll" method="post">
            快速查找：<input autocomplete="off" type="text" id="name999">
            食物名称：<input type="text" id="tname" name="name" />
            <input type="hidden" id="reliang" name="reliang">
            <input type="hidden" value="3" name="type">
            食物重量：<input type="text" name="zl" />
            <button type="submit">提交</button>
        </form>
    </div>


    <div id="solist" style="display: none;">
        <?php foreach ($arr as $v){ ?>
        <div data-id="<?php echo $v['id']; ?>" data-reliang="<?php echo $v['reliang']; ?>" class="list"><?php echo $v['name']; ?></div>
        <?php } ?>
        <?php foreach ($zhongyao['eatlist'] as $v){ ?>
        <div class="list2" style="border-color: green;"><?php echo $v['hebing']; ?></div>
        <?php } ?>
    </div>
    <div style="clear: both;width: 100%;"></div>

    <div id="srkll2" style="display:none;">
        <h1>录入食物</h1>
        <form action="http://jianfei.lightrain.org.cn/index/lrshiwu" method="post">
            食物名称：<input id="name" type="text" name="name" />
            食物缩写：<input id="suoxie" type="text" name="pinyin" />
            每100克食物热量（单位大卡/千卡）：<input type="text" name="reliang" />
            <button type="submit">提交</button>
        </form>
    </div>
    <div id="srkll3">
        <h1>录入体重</h1>
        <form action="http://jianfei.lightrain.org.cn/index/luru" method="post">
            今日体重：<?php echo $tz; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            录入体重：<input id="name666" type="text" name="jinshu" />
            <button type="submit">提交</button>
        </form>
    </div>
    <div id="srkll4">
        <h1>录入运动</h1>
        <form action="http://jianfei.lightrain.org.cn/index/lurukll" method="post">
            今日消耗：<?php echo $kll; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            录入消耗：<input id="name6666" type="text" name="iwatch" />
            <button type="submit">提交</button>
        </form>
    </div>
    <div style="clear: both;width: 100%;"></div>
    <h3 style="clear: both; width: 1200px;margin: 40px auto;text-align: center;">
        减肥时间：180天
        减重量：<?php echo $zhongyao['kg']; ?>千克
        消耗总量：<?php echo $zhongyao['zkll']; ?>
        每天消耗：<?php echo $zhongyao['daykll']; ?>
        每天减重：<?php echo $zhongyao['dayjz']; ?>斤<br>
        实际消耗：<?php echo $zhongyao['xiaohaokll']; ?>
        完成比例：<?php echo $zhongyao['wanchengbl']; ?>%
        还差热量：<?php echo $zhongyao['daykll']-$zhongyao['sjxh']; ?>
    </h3>
</div>

{/block}

{block name="js"}

    <script>

        $(document).ready(function () {
            $("#mrysjl").click(function (){
                $("#solist").toggle()
            })
            $("#name").keyup(function () {
                var name = $(this).val()
                $.post("/index/getpinyin", {
                        name: name
                    },
                    function (data) {
                        $('#suoxie').val(data)
                    }
                );
            })
            $(document).on("click",".list",function (){
                var id=$(this).data("id")
                var reliang=$(this).data("reliang")
                var text=$(this).text()
                $("#tname").val(text)
                $("#reliang").val(reliang)
            })
        $("#name999").keyup(function () {
            var name = $(this).val()
            $.post("/index/getshiwuname", {
                    name: name
                },
                function (data) {
                    html=''
                    data=JSON.parse(data)
                    for (var i=0;i<data.length;i++){
                        html+='<div data-id="'+data[i].id+'" data-reliang="'+data[i].reliang+'" class="list">'+data[i].name+'</div>\n'
                    }
                    $('#solist').html(html)
                }
            );
        })
    })
</script>
<style>
    #solist,#solist5{
        margin-top: 30px;
        width: 1200px;
    }
    .list{
        float: left;
        padding: 5px;
        margin-right: 10px;
        margin-left: 10px;
        margin-bottom: 10px;
        border: 1px solid red;
    }
    .list2{
        float: left;
        padding: 5px;
        margin-right: 10px;
        margin-left: 10px;
        margin-bottom: 10px;
        border: 1px solid red;
    }
    #srkll,#srkll2,#srkll5{
        text-align: center;
        padding-top: 10px;
        width: 1200px;
    }
    #srkll3,#srkll4{
        text-align: center;
        padding-top: 10px;
        width: 1200px;
        float: left;
    }
</style>
{/block}